-- =============================================
-- POS系统测试数据脚本 - Oracle版本
-- 创建时间: 2025-01-30
-- 描述: POS系统测试数据
-- =============================================

-- 清空现有数据（按依赖关系顺序）
DELETE FROM pos_sale_pay;
DELETE FROM pos_sale_detail;
DELETE FROM pos_sale;
DELETE FROM pos_device_debug_log;
DELETE FROM pos_device_permission_approval;
DELETE FROM pos_device_group_permission;
DELETE FROM pos_cashier_device;
DELETE FROM pos_cashier_group;
DELETE FROM pos_payment_type_group;
DELETE FROM pos_payment_type;
DELETE FROM pos_print_scheme;
DELETE FROM pos_system_config;
DELETE FROM pos_cashier;
DELETE FROM pos_device;
DELETE FROM pos_group;

-- 重置序列
DROP SEQUENCE seq_pos_group;
DROP SEQUENCE seq_pos_device;
DROP SEQUENCE seq_pos_cashier;
DROP SEQUENCE seq_pos_cashier_group;
DROP SEQUENCE seq_pos_cashier_device;
DROP SEQUENCE seq_pos_device_group_permission;
DROP SEQUENCE seq_pos_device_permission_approval;
DROP SEQUENCE seq_pos_device_debug_log;
DROP SEQUENCE seq_pos_sale;
DROP SEQUENCE seq_pos_sale_detail;
DROP SEQUENCE seq_pos_sale_pay;
DROP SEQUENCE seq_pos_payment_type;
DROP SEQUENCE seq_pos_payment_type_group;
DROP SEQUENCE seq_pos_print_scheme;
DROP SEQUENCE seq_pos_system_config;

-- 重新创建序列
CREATE SEQUENCE seq_pos_group START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE seq_pos_device START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE seq_pos_cashier START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE seq_pos_cashier_group START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE seq_pos_cashier_device START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE seq_pos_device_group_permission START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE seq_pos_device_permission_approval START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE seq_pos_device_debug_log START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE seq_pos_sale START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE seq_pos_sale_detail START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE seq_pos_sale_pay START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE seq_pos_payment_type START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE seq_pos_payment_type_group START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE seq_pos_print_scheme START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE seq_pos_system_config START WITH 1 INCREMENT BY 1;

-- 1. 插入柜组数据
INSERT INTO pos_group (group_id, group_code, group_name, parent_id, ancestors, order_num, group_type, leader, phone, email, status, del_flag, create_by, create_time, remark) VALUES
(seq_pos_group.NEXTVAL, 'FLOOR_1', '一楼', 0, '0', 1, 'NORMAL', '张经理', '13800138001', 'zhang@example.com', '0', '0', 'admin', SYSDATE, '一楼整体管理');

INSERT INTO pos_group (group_id, group_code, group_name, parent_id, ancestors, order_num, group_type, leader, phone, email, status, del_flag, create_by, create_time, remark) VALUES
(seq_pos_group.NEXTVAL, 'FLOOR_2', '二楼', 0, '0', 2, 'NORMAL', '李经理', '13800138002', 'li@example.com', '0', '0', 'admin', SYSDATE, '二楼整体管理');

INSERT INTO pos_group (group_id, group_code, group_name, parent_id, ancestors, order_num, group_type, leader, phone, email, status, del_flag, create_by, create_time, remark) VALUES
(seq_pos_group.NEXTVAL, 'F1_FOOD', '一楼食品区', 1, '0,1', 1, 'NORMAL', '王主管', '13800138003', 'wang@example.com', '0', '0', 'admin', SYSDATE, '一楼食品销售区');

INSERT INTO pos_group (group_id, group_code, group_name, parent_id, ancestors, order_num, group_type, leader, phone, email, status, del_flag, create_by, create_time, remark) VALUES
(seq_pos_group.NEXTVAL, 'F1_CLOTH', '一楼服装区', 1, '0,1', 2, 'NORMAL', '赵主管', '13800138004', 'zhao@example.com', '0', '0', 'admin', SYSDATE, '一楼服装销售区');

INSERT INTO pos_group (group_id, group_code, group_name, parent_id, ancestors, order_num, group_type, leader, phone, email, status, del_flag, create_by, create_time, remark) VALUES
(seq_pos_group.NEXTVAL, 'F2_ELECTRONICS', '二楼电子产品区', 2, '0,2', 1, 'NORMAL', '陈主管', '13800138005', 'chen@example.com', '0', '0', 'admin', SYSDATE, '二楼电子产品销售区');

INSERT INTO pos_group (group_id, group_code, group_name, parent_id, ancestors, order_num, group_type, leader, phone, email, status, del_flag, create_by, create_time, remark) VALUES
(seq_pos_group.NEXTVAL, 'F2_BOOKS', '二楼图书区', 2, '0,2', 2, 'NORMAL', '刘主管', '13800138006', 'liu@example.com', '0', '0', 'admin', SYSDATE, '二楼图书销售区');

-- 2. 插入POS设备数据
INSERT INTO pos_device (device_id, device_code, device_name, device_type, ip_address, mac_address, firmware_version, status, last_heartbeat_time, config_version, del_flag, create_by, create_time, remark) VALUES
(seq_pos_device.NEXTVAL, 'POS001', '一楼收银台1', 'DESKTOP', '192.168.1.101', '00:11:22:33:44:01', 'V1.2.3', '0', SYSDATE, 'CONFIG_V1', '0', 'admin', SYSDATE, '一楼固定收银台');

INSERT INTO pos_device (device_id, device_code, device_name, device_type, ip_address, mac_address, firmware_version, status, last_heartbeat_time, config_version, del_flag, create_by, create_time, remark) VALUES
(seq_pos_device.NEXTVAL, 'POS002', '一楼收银台2', 'DESKTOP', '192.168.1.102', '00:11:22:33:44:02', 'V1.2.3', '0', SYSDATE, 'CONFIG_V1', '0', 'admin', SYSDATE, '一楼固定收银台');

INSERT INTO pos_device (device_id, device_code, device_name, device_type, ip_address, mac_address, firmware_version, status, last_heartbeat_time, config_version, del_flag, create_by, create_time, remark) VALUES
(seq_pos_device.NEXTVAL, 'HANDHELD001', '移动POS-001', 'HANDHELD', '192.168.1.201', '00:11:22:33:44:11', 'V1.2.3', '0', SYSDATE, 'CONFIG_V1', '0', 'admin', SYSDATE, '手持移动POS设备');

INSERT INTO pos_device (device_id, device_code, device_name, device_type, ip_address, mac_address, firmware_version, status, last_heartbeat_time, config_version, del_flag, create_by, create_time, remark) VALUES
(seq_pos_device.NEXTVAL, 'HANDHELD002', '移动POS-002', 'HANDHELD', '192.168.1.202', '00:11:22:33:44:12', 'V1.2.3', '0', SYSDATE, 'CONFIG_V1', '0', 'admin', SYSDATE, '手持移动POS设备');

INSERT INTO pos_device (device_id, device_code, device_name, device_type, ip_address, mac_address, firmware_version, status, last_heartbeat_time, config_version, del_flag, create_by, create_time, remark) VALUES
(seq_pos_device.NEXTVAL, 'POS003', '二楼收银台1', 'DESKTOP', '192.168.1.103', '00:11:22:33:44:03', 'V1.2.3', '0', SYSDATE, 'CONFIG_V1', '0', 'admin', SYSDATE, '二楼固定收银台');

INSERT INTO pos_device (device_id, device_code, device_name, device_type, ip_address, mac_address, firmware_version, status, last_heartbeat_time, config_version, del_flag, create_by, create_time, remark) VALUES
(seq_pos_device.NEXTVAL, 'TABLET001', '平板POS-001', 'TABLET', '192.168.1.301', '00:11:22:33:44:21', 'V1.2.3', '0', SYSDATE, 'CONFIG_V1', '0', 'admin', SYSDATE, '平板POS设备');

-- 3. 插入收银员数据
INSERT INTO pos_cashier (cashier_id, cashier_code, cashier_name, phone, email, password, status, del_flag, create_by, create_time, remark) VALUES
(seq_pos_cashier.NEXTVAL, 'C001', '张三', '13900139001', 'zhangsan@example.com', '$2a$10$7JB720yubVSOfvVWbX5XUe8Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q', '0', '0', 'admin', SYSDATE, '资深收银员');

INSERT INTO pos_cashier (cashier_id, cashier_code, cashier_name, phone, email, password, status, del_flag, create_by, create_time, remark) VALUES
(seq_pos_cashier.NEXTVAL, 'C002', '李四', '13900139002', 'lisi@example.com', '$2a$10$7JB720yubVSOfvVWbX5XUe8Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q', '0', '0', 'admin', SYSDATE, '收银员');

INSERT INTO pos_cashier (cashier_id, cashier_code, cashier_name, phone, email, password, status, del_flag, create_by, create_time, remark) VALUES
(seq_pos_cashier.NEXTVAL, 'C003', '王五', '13900139003', 'wangwu@example.com', '$2a$10$7JB720yubVSOfvVWbX5XUe8Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q', '0', '0', 'admin', SYSDATE, '收银员');

INSERT INTO pos_cashier (cashier_id, cashier_code, cashier_name, phone, email, password, status, del_flag, create_by, create_time, remark) VALUES
(seq_pos_cashier.NEXTVAL, 'C004', '赵六', '13900139004', 'zhaoliu@example.com', '$2a$10$7JB720yubVSOfvVWbX5XUe8Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q', '0', '0', 'admin', SYSDATE, '收银员');

INSERT INTO pos_cashier (cashier_id, cashier_code, cashier_name, phone, email, password, status, del_flag, create_by, create_time, remark) VALUES
(seq_pos_cashier.NEXTVAL, 'C005', '陈七', '13900139005', 'chenqi@example.com', '$2a$10$7JB720yubVSOfvVWbX5XUe8Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q5Q', '0', '0', 'admin', SYSDATE, '收银员');

-- 4. 插入收银员-柜组关联数据
INSERT INTO pos_cashier_group (id, cashier_id, group_id, create_time, create_by) VALUES
(seq_pos_cashier_group.NEXTVAL, 1, 3, SYSDATE, 'admin'); -- 张三管理一楼食品区

INSERT INTO pos_cashier_group (id, cashier_id, group_id, create_time, create_by) VALUES
(seq_pos_cashier_group.NEXTVAL, 1, 4, SYSDATE, 'admin'); -- 张三管理一楼服装区

INSERT INTO pos_cashier_group (id, cashier_id, group_id, create_time, create_by) VALUES
(seq_pos_cashier_group.NEXTVAL, 2, 3, SYSDATE, 'admin'); -- 李四管理一楼食品区

INSERT INTO pos_cashier_group (id, cashier_id, group_id, create_time, create_by) VALUES
(seq_pos_cashier_group.NEXTVAL, 3, 4, SYSDATE, 'admin'); -- 王五管理一楼服装区

INSERT INTO pos_cashier_group (id, cashier_id, group_id, create_time, create_by) VALUES
(seq_pos_cashier_group.NEXTVAL, 4, 5, SYSDATE, 'admin'); -- 赵六管理二楼电子产品区

INSERT INTO pos_cashier_group (id, cashier_id, group_id, create_time, create_by) VALUES
(seq_pos_cashier_group.NEXTVAL, 5, 6, SYSDATE, 'admin'); -- 陈七管理二楼图书区

-- 5. 插入收银员-设备关联数据
INSERT INTO pos_cashier_device (id, cashier_id, device_id, create_time, create_by) VALUES
(seq_pos_cashier_device.NEXTVAL, 1, 1, SYSDATE, 'admin'); -- 张三使用POS001

INSERT INTO pos_cashier_device (id, cashier_id, device_id, create_time, create_by) VALUES
(seq_pos_cashier_device.NEXTVAL, 1, 3, SYSDATE, 'admin'); -- 张三使用HANDHELD001

INSERT INTO pos_cashier_device (id, cashier_id, device_id, create_time, create_by) VALUES
(seq_pos_cashier_device.NEXTVAL, 2, 2, SYSDATE, 'admin'); -- 李四使用POS002

INSERT INTO pos_cashier_device (id, cashier_id, device_id, create_time, create_by) VALUES
(seq_pos_cashier_device.NEXTVAL, 3, 3, SYSDATE, 'admin'); -- 王五使用HANDHELD001

INSERT INTO pos_cashier_device (id, cashier_id, device_id, create_time, create_by) VALUES
(seq_pos_cashier_device.NEXTVAL, 4, 4, SYSDATE, 'admin'); -- 赵六使用HANDHELD002

INSERT INTO pos_cashier_device (id, cashier_id, device_id, create_time, create_by) VALUES
(seq_pos_cashier_device.NEXTVAL, 5, 5, SYSDATE, 'admin'); -- 陈七使用POS003

-- 6. 插入设备柜组权限数据
-- 固定权限：POS001固定绑定一楼食品区
INSERT INTO pos_device_group_permission (id, device_id, group_id, permission_type, status, create_by, create_time, remark) VALUES
(seq_pos_device_group_permission.NEXTVAL, 1, 3, 'FIXED', 'ACTIVE', 'admin', SYSDATE, 'POS001固定权限');

-- 固定权限：POS002固定绑定一楼服装区
INSERT INTO pos_device_group_permission (id, device_id, group_id, permission_type, status, create_by, create_time, remark) VALUES
(seq_pos_device_group_permission.NEXTVAL, 2, 4, 'FIXED', 'ACTIVE', 'admin', SYSDATE, 'POS002固定权限');

-- 移动权限：HANDHELD001可以收银整个一楼
INSERT INTO pos_device_group_permission (id, device_id, group_id, permission_type, status, create_by, create_time, remark) VALUES
(seq_pos_device_group_permission.NEXTVAL, 3, 3, 'MOBILE', 'ACTIVE', 'admin', SYSDATE, 'HANDHELD001移动权限-食品区');

INSERT INTO pos_device_group_permission (id, device_id, group_id, permission_type, status, create_by, create_time, remark) VALUES
(seq_pos_device_group_permission.NEXTVAL, 3, 4, 'MOBILE', 'ACTIVE', 'admin', SYSDATE, 'HANDHELD001移动权限-服装区');

-- 移动权限：HANDHELD002可以收银整个二楼
INSERT INTO pos_device_group_permission (id, device_id, group_id, permission_type, status, create_by, create_time, remark) VALUES
(seq_pos_device_group_permission.NEXTVAL, 4, 5, 'MOBILE', 'ACTIVE', 'admin', SYSDATE, 'HANDHELD002移动权限-电子产品区');

INSERT INTO pos_device_group_permission (id, device_id, group_id, permission_type, status, create_by, create_time, remark) VALUES
(seq_pos_device_group_permission.NEXTVAL, 4, 6, 'MOBILE', 'ACTIVE', 'admin', SYSDATE, 'HANDHELD002移动权限-图书区');

-- 临时权限：TABLET001在特定时间段可以收银一楼食品区
INSERT INTO pos_device_group_permission (id, device_id, group_id, permission_type, start_time, end_time, reason, status, create_by, create_time, remark) VALUES
(seq_pos_device_group_permission.NEXTVAL, 6, 3, 'TEMPORARY', SYSDATE, SYSDATE + 7, '促销活动期间临时调配', 'ACTIVE', 'admin', SYSDATE, 'TABLET001临时权限');

-- 7. 插入支付方式数据
INSERT INTO pos_payment_type (payment_id, payment_code, payment_name, payment_icon, sort_order, status, create_time, remark) VALUES
(seq_pos_payment_type.NEXTVAL, 'CASH', '现金', 'cash.png', 1, '0', SYSDATE, '现金支付');

INSERT INTO pos_payment_type (payment_id, payment_code, payment_name, payment_icon, sort_order, status, create_time, remark) VALUES
(seq_pos_payment_type.NEXTVAL, 'ALIPAY', '支付宝', 'alipay.png', 2, '0', SYSDATE, '支付宝支付');

INSERT INTO pos_payment_type (payment_id, payment_code, payment_name, payment_icon, sort_order, status, create_time, remark) VALUES
(seq_pos_payment_type.NEXTVAL, 'WECHAT', '微信支付', 'wechat.png', 3, '0', SYSDATE, '微信支付');

INSERT INTO pos_payment_type (payment_id, payment_code, payment_name, payment_icon, sort_order, status, create_time, remark) VALUES
(seq_pos_payment_type.NEXTVAL, 'UNIONPAY', '银联卡', 'unionpay.png', 4, '0', SYSDATE, '银联卡支付');

-- 8. 插入支付方式组关联数据
INSERT INTO pos_payment_type_group (id, payment_id, group_id, is_enabled, sort_order, create_time) VALUES
(seq_pos_payment_type_group.NEXTVAL, 1, 3, '1', 1, SYSDATE); -- 一楼食品区支持现金

INSERT INTO pos_payment_type_group (id, payment_id, group_id, is_enabled, sort_order, create_time) VALUES
(seq_pos_payment_type_group.NEXTVAL, 2, 3, '1', 2, SYSDATE); -- 一楼食品区支持支付宝

INSERT INTO pos_payment_type_group (id, payment_id, group_id, is_enabled, sort_order, create_time) VALUES
(seq_pos_payment_type_group.NEXTVAL, 3, 3, '1', 3, SYSDATE); -- 一楼食品区支持微信

INSERT INTO pos_payment_type_group (id, payment_id, group_id, is_enabled, sort_order, create_time) VALUES
(seq_pos_payment_type_group.NEXTVAL, 1, 4, '1', 1, SYSDATE); -- 一楼服装区支持现金

INSERT INTO pos_payment_type_group (id, payment_id, group_id, is_enabled, sort_order, create_time) VALUES
(seq_pos_payment_type_group.NEXTVAL, 2, 4, '1', 2, SYSDATE); -- 一楼服装区支持支付宝

INSERT INTO pos_payment_type_group (id, payment_id, group_id, is_enabled, sort_order, create_time) VALUES
(seq_pos_payment_type_group.NEXTVAL, 3, 4, '1', 3, SYSDATE); -- 一楼服装区支持微信

INSERT INTO pos_payment_type_group (id, payment_id, group_id, is_enabled, sort_order, create_time) VALUES
(seq_pos_payment_type_group.NEXTVAL, 4, 4, '1', 4, SYSDATE); -- 一楼服装区支持银联卡

-- 9. 插入打印方案数据
INSERT INTO pos_print_scheme (scheme_id, scheme_name, scheme_type, template_content, is_default, status, create_by, create_time, remark) VALUES
(seq_pos_print_scheme.NEXTVAL, '标准小票模板', 'RECEIPT', '标准小票打印模板内容', '1', '0', 'admin', SYSDATE, '标准销售小票打印模板');

INSERT INTO pos_print_scheme (scheme_id, scheme_name, scheme_type, template_content, is_default, status, create_by, create_time, remark) VALUES
(seq_pos_print_scheme.NEXTVAL, '退货小票模板', 'RECEIPT', '退货小票打印模板内容', '0', '0', 'admin', SYSDATE, '退货小票打印模板');

INSERT INTO pos_print_scheme (scheme_id, scheme_name, scheme_type, template_content, is_default, status, create_by, create_time, remark) VALUES
(seq_pos_print_scheme.NEXTVAL, '商品标签模板', 'LABEL', '商品标签打印模板内容', '0', '0', 'admin', SYSDATE, '商品标签打印模板');

-- 10. 插入系统配置数据
INSERT INTO pos_system_config (config_id, config_key, config_value, config_type, config_group, is_system, status, create_by, create_time, remark) VALUES
(seq_pos_system_config.NEXTVAL, 'pos.system.name', 'POS收银系统', 'STRING', 'SYSTEM', '1', '0', 'admin', SYSDATE, '系统名称');

INSERT INTO pos_system_config (config_id, config_key, config_value, config_type, config_group, is_system, status, create_by, create_time, remark) VALUES
(seq_pos_system_config.NEXTVAL, 'pos.system.version', '1.0.0', 'STRING', 'SYSTEM', '1', '0', 'admin', SYSDATE, '系统版本');

INSERT INTO pos_system_config (config_id, config_key, config_value, config_type, config_group, is_system, status, create_by, create_time, remark) VALUES
(seq_pos_system_config.NEXTVAL, 'pos.heartbeat.interval', '30', 'NUMBER', 'DEVICE', '0', '0', 'admin', SYSDATE, '设备心跳间隔（秒）');

INSERT INTO pos_system_config (config_id, config_key, config_value, config_type, config_group, is_system, status, create_by, create_time, remark) VALUES
(seq_pos_system_config.NEXTVAL, 'pos.debug.enabled', 'true', 'BOOLEAN', 'DEBUG', '0', '0', 'admin', SYSDATE, '是否启用调试模式');

-- 11. 插入设备调试日志数据
INSERT INTO pos_device_debug_log (log_id, device_id, log_level, log_content, log_type, source, session_id, create_time, remark) VALUES
(seq_pos_device_debug_log.NEXTVAL, 1, 'INFO', '设备启动成功', 'SYSTEM', 'DEVICE', 'SESSION_001', SYSDATE, '设备启动日志');

INSERT INTO pos_device_debug_log (log_id, device_id, log_level, log_content, log_type, source, session_id, create_time, remark) VALUES
(seq_pos_device_debug_log.NEXTVAL, 1, 'INFO', '心跳检测正常', 'SYSTEM', 'DEVICE', 'SESSION_001', SYSDATE, '心跳检测日志');

INSERT INTO pos_device_debug_log (log_id, device_id, log_level, log_content, log_type, source, session_id, create_time, remark) VALUES
(seq_pos_device_debug_log.NEXTVAL, 3, 'INFO', '移动POS连接成功', 'SYSTEM', 'DEVICE', 'SESSION_002', SYSDATE, '移动设备连接日志');

-- 12. 插入销售数据（示例）
INSERT INTO pos_sale (sale_id, sale_no, device_id, cashier_id, group_id, group_name, group_code, total_amount, discount_amount, pay_amount, change_amount, sale_type, status, sale_time, create_time, remark) VALUES
(seq_pos_sale.NEXTVAL, 'S202501300001', 1, 1, 3, '一楼食品区', 'F1_FOOD', 156.80, 0.00, 156.80, 0.00, 'SALE', 'COMPLETED', SYSDATE, SYSDATE, '正常销售');

INSERT INTO pos_sale (sale_id, sale_no, device_id, cashier_id, group_id, group_name, group_code, total_amount, discount_amount, pay_amount, change_amount, sale_type, status, sale_time, create_time, remark) VALUES
(seq_pos_sale.NEXTVAL, 'S202501300002', 3, 1, 4, '一楼服装区', 'F1_CLOTH', 299.00, 29.90, 269.10, 0.00, 'SALE', 'COMPLETED', SYSDATE, SYSDATE, '移动POS跨区销售');

-- 13. 插入销售明细数据
INSERT INTO pos_sale_detail (detail_id, sale_id, goods_code, goods_name, goods_spec, unit, quantity, unit_price, amount, discount_rate, discount_amount, create_time, remark) VALUES
(seq_pos_sale_detail.NEXTVAL, 1, 'G001', '可口可乐', '500ml', '瓶', 2.000, 3.50, 7.00, 0.00, 0.00, SYSDATE, '饮料商品');

INSERT INTO pos_sale_detail (detail_id, sale_id, goods_code, goods_name, goods_spec, unit, quantity, unit_price, amount, discount_rate, discount_amount, create_time, remark) VALUES
(seq_pos_sale_detail.NEXTVAL, 1, 'G002', '薯片', '原味', '包', 3.000, 8.50, 25.50, 0.00, 0.00, SYSDATE, '零食商品');

INSERT INTO pos_sale_detail (detail_id, sale_id, goods_code, goods_name, goods_spec, unit, quantity, unit_price, amount, discount_rate, discount_amount, create_time, remark) VALUES
(seq_pos_sale_detail.NEXTVAL, 2, 'G003', 'T恤', 'L码', '件', 1.000, 299.00, 299.00, 10.00, 29.90, SYSDATE, '服装商品');

-- 14. 插入销售支付数据
INSERT INTO pos_sale_pay (pay_id, sale_id, payment_type, payment_name, pay_amount, pay_time, create_time, remark) VALUES
(seq_pos_sale_pay.NEXTVAL, 1, 'CASH', '现金', 156.80, SYSDATE, SYSDATE, '现金支付');

INSERT INTO pos_sale_pay (pay_id, sale_id, payment_type, payment_name, pay_amount, pay_time, create_time, remark) VALUES
(seq_pos_sale_pay.NEXTVAL, 2, 'ALIPAY', '支付宝', 269.10, SYSDATE, SYSDATE, '支付宝支付');

-- 提交事务
COMMIT;

-- 显示插入结果统计
SELECT '柜组数据' AS 数据类型, COUNT(*) AS 记录数 FROM pos_group
UNION ALL
SELECT 'POS设备数据', COUNT(*) FROM pos_device
UNION ALL
SELECT '收银员数据', COUNT(*) FROM pos_cashier
UNION ALL
SELECT '收银员-柜组关联', COUNT(*) FROM pos_cashier_group
UNION ALL
SELECT '收银员-设备关联', COUNT(*) FROM pos_cashier_device
UNION ALL
SELECT '设备权限数据', COUNT(*) FROM pos_device_group_permission
UNION ALL
SELECT '支付方式数据', COUNT(*) FROM pos_payment_type
UNION ALL
SELECT '支付方式组关联', COUNT(*) FROM pos_payment_type_group
UNION ALL
SELECT '打印方案数据', COUNT(*) FROM pos_print_scheme
UNION ALL
SELECT '系统配置数据', COUNT(*) FROM pos_system_config
UNION ALL
SELECT '调试日志数据', COUNT(*) FROM pos_device_debug_log
UNION ALL
SELECT '销售数据', COUNT(*) FROM pos_sale
UNION ALL
SELECT '销售明细数据', COUNT(*) FROM pos_sale_detail
UNION ALL
SELECT '销售支付数据', COUNT(*) FROM pos_sale_pay;
